package com.example.day8_sp;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity3 extends AppCompatActivity {

    private EditText username;
    private EditText password;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main3);
        initView();
        username.setText(SPUtils.get("username"));
        password.setText(SPUtils.get("password"));
    }

    public void login(View view) {
        SPUtils.put("username",username.getText().toString());
        SPUtils.put("password",password.getText().toString());
        startActivity(new Intent(this,MainActivity.class));
    }

    private void initView() {
        username = (EditText) findViewById(R.id.username);
        password = (EditText) findViewById(R.id.password);
    }
}